//
//  ShareSortHeaderView.m
//  兼职页面
//
//  Created by kuiyuan liang on 2021/5/28.
//

#import "ShareSortHeaderView.h"
#import "CommonUtil.h"
#import "UserInfoView.h"


@interface ShareSortHeaderView()

@property (strong, nonatomic) UILabel * tipLabel;
@property (strong, nonatomic) UserInfoView * firstInfoView;
@property (strong, nonatomic) UserInfoView * secondInfoView;
@property (strong, nonatomic) UserInfoView * thirdInfoView;
@property (strong, nonatomic) UIView * bottomView;
@end

@implementation ShareSortHeaderView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = RGB(234.0, 134.0, 79.0);
        [self addSubview:self.tipLabel];
        [self addSubview:self.bottomView];
        [self addSubview:self.secondInfoView];
        [self addSubview:self.firstInfoView];
        [self addSubview:self.thirdInfoView];
        _firstInfoView.centerX = SCREEN_WIDTH/2;
        _secondInfoView.left = AD(20);
        _thirdInfoView.left = _firstInfoView.right + AD(20);
    }
    return self;
}

-(void)setModels:(NSMutableArray *)models{
    _models = models;
    
    self.firstInfoView.model = models[0];
    self.secondInfoView.model = models[1];
    self.thirdInfoView.model = models[2];
}


-(UILabel *)tipLabel{
    if (!_tipLabel) {
        _tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(AD(15), 0, AD(300), AD(25))];
        _tipLabel.font = [UIFont boldSystemFontOfSize:AD(15)];
        _tipLabel.textColor = [UIColor whiteColor];
        _tipLabel.text = @"登记排名每天凌晨自动更新";
    }
    return _tipLabel;
}

-(UserInfoView *)firstInfoView{
    if (!_firstInfoView) {
        _firstInfoView = [[UserInfoView alloc] initWithFrame:CGRectMake(0, AD(70), _secondInfoView.width, _secondInfoView.height)];
    }
    return _firstInfoView;
}


-(UserInfoView *)secondInfoView{
    if (!_secondInfoView) {
        _secondInfoView = [[UserInfoView alloc] initWithFrame:CGRectMake(0, AD(90), (SCREEN_WIDTH-AD(80))/3, AD(135))];
        
    }
    return _secondInfoView;
}


-(UserInfoView *)thirdInfoView{
    if (!_thirdInfoView) {
        _thirdInfoView = [[UserInfoView alloc] initWithFrame:CGRectMake(0, AD(90), _secondInfoView.width, _secondInfoView.height)];
       
    }
    return _thirdInfoView;
}
-(UIView *)bottomView{
    if (!_bottomView) {
        _bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.height-AD(80), SCREEN_WIDTH, AD(80))];
        _bottomView.backgroundColor = RGB(243.0, 243.0, 243.0);
    }
    return _bottomView;
}

@end
